package com.Oct_Thirty;

import java.util.ArrayList;
import java.util.List;

public class Solution784 {

    List<String> list=new ArrayList<>();
    char[] array;
    public List<String> letterCasePermutation(String s) {
        array=s.toCharArray();
        dfs(new StringBuilder(),0);
        return list;
    }

    void dfs(StringBuilder sb,int index){
        if (index==array.length)
        {
            list.add(sb.toString());
            return;
        }
        if (!(array[index]<='9'&&array[index]>='0'))
        {
            dfs(new StringBuilder(sb).append((char) (array[index]^32)), index+1);
        }
        dfs(new StringBuilder(sb).append(array[index]),index+1);
    }

    public static void main(String[] args) {
        Solution784 solution784=new Solution784();
        System.out.println(solution784.letterCasePermutation("a1b2"));
    }
}
